package cn.ld.module.infra.dal.mapper.file;

import cn.ld.framework.common.pojo.PageResult;
import cn.ld.framework.mybatis.core.mapper.BaseMapperX;
import cn.ld.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.ld.module.infra.controller.admin.file.vo.file.FilePageInVO;
import cn.ld.module.infra.dal.entity.file.FileEntity;
import org.apache.ibatis.annotations.Mapper;

/**
 * 文件操作 Mapper
 *
 * @author 蓝盾
 */
@Mapper
public interface FileMapper extends BaseMapperX<FileEntity> {

    default PageResult<FileEntity> selectPage(FilePageInVO inVO) {
        return selectPage(inVO, new LambdaQueryWrapperX<FileEntity>()
                .likeIfPresent(FileEntity::getPath, inVO.getPath())
                .likeIfPresent(FileEntity::getType, inVO.getType())
                .betweenIfPresent(FileEntity::getCreateTime, inVO.getCreateTime())
                .orderByDesc(FileEntity::getId));
    }

}
